		<!--  START META DATA FIELDS -->
        <div class="metadatabox" id="metadatabox">
        <table cellspacing="10" class="metadata">
		<tr><td colspan="2" style="background: none;"><h1>Personal Metadata Fields</h1></td></tr>		
		{section name=meta loop=$metafields}
		{assign var=fieldID value=$metafields[meta].ID}
        {if $metavalues.$fieldID == ''}
    		{assign var=metadisplay value='none'}
        {else}
    		{assign var=metadisplay value='block'}
        {/if}
		
        <tr style="display: {$metadisplay};" id="meta_row_{$fieldID}{$fields[entrytypes].name}"><th style="background: none;"><a class="meta_field_remove {literal}{{/literal} fieldID:{$fieldID}, type:'{$fields[entrytypes].name}', datatype:'{$metafields[meta].type}' {literal}}{/literal}">-</a><span id="meta_name_{$fieldID}{$fields[entrytypes].name}">{$metafields[meta].name|capitalize}</span></th>
        <td style="background: none;">
        
        {if $metafields[meta].type == 'st'}
        <!-- Short Text Field -->
        <input type="text" name="meta[{$fieldID}]" id="meta_{$fieldID}" value="{$metavalues.$fieldID}" />
        {literal}
        <script type="text/javascript"> 
        $(function() {	
            $("#{/literal}meta_{$metafields[meta].fieldID}{literal}").autocomplete("autocomplete.php?t=meta&fieldID={/literal}{$metafields[meta].fieldID}{literal}", 
                    { minChars:0, matchSubset:1, matchContains:1, cacheLength:10, selectOnly:1, width:'300' });
        });
        </script>
        {/literal}				
        
        
        
        {elseif $metafields[meta].type == 'lt'}      
        <!-- Long Text Field -->         
        <textarea rows="5" name="meta[{$fieldID}]">{$metavalues.$fieldID}</textarea>

		{elseif $metafields[meta].type == 'dt'}
		<!-- Date Field -->
		<input type="text" class="date_input" name="meta[{$fieldID}]" value="{$metavalues.$fieldID}" />
	    	
        
        {elseif $metafields[meta].type == 'il'}
        <!-- Select Box Field -->         
            <select name="meta[{$fieldID}]">
            <option style="color: #f00;" value="">Blank</option>
            {html_options values=$metafields[meta].items output=$metafields[meta].items selected=$metavalues.$fieldID}
            </select>

        {elseif $metafields[meta].type == 'kw'}
        <!-- Keyword Field -->
        <div class="meta_keyword_container" id="meta_kw_{$fieldID}{$fields[entrytypes].name}">
        <span><a class="meta_keyword_button meta_keyword_add {literal}{{/literal} fieldID:{$fieldID}, type:'{$fields[entrytypes].name}' {literal}}{/literal}">+</a></span>
        {foreach from=$metavalues.$fieldID item=val}
            <span class="meta_keyword"><a class="meta_keyword_button meta_keyword_remove">-</a>&nbsp;{nospaces val=$val}<input type="hidden" name="meta[{$fieldID}][]" value="{$val}" /></span>       
        {/foreach}    
        </div>
        {/if}        
        </td>
        </tr>		
		{/section}

        <!-- Add Additional Fields -->
		<tr><td colspan="2" align="center" style="background: none;">
		<div class="addmetabox">
		<select name="metarows" id="metarows_{$fields[entrytypes].name}">
		{section name=meta loop=$metafields}
    		{assign var=fieldID value=$metafields[meta].ID}		
            {if $metavalues.$fieldID == ''}
            <option id="meta_opt_{$fieldID}{$fields[entrytypes].name}" value="{$fieldID}">{$metafields[meta].name|capitalize}</option>
            {/if}
        {/section}		  
		</select>&nbsp;<button class="addfield {literal}{{/literal} type:'{$fields[entrytypes].name}' {literal}}{/literal}">Add Field</button>
		</div>
		</td></tr>		        
		{if $fields[entrytypes].name}
		{assign var="saveName" value=$fields[entrytypes].name}
		{else}
		{assign var="saveName" value="Metadata"}
		{/if}
		<tr><td colspan="2" align="center" style="background: none;"><input type="submit" class="submit" value="Save {$saveName|capitalize}" /></td></tr>		
    	</table></div>	
		<!--  END META DATA FIELDS -->
